<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>主页</title>
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{lib/css/main.css}">
    <link rel="stylesheet" th:href="@{/lib/css/public.css}">
    <script th:src="@{/lib/js/jquery-3.4.1.min.js}"></script>
    <script th:src="@{/layui/layui.js}"></script>
</head>
<style>
    .body{
        margin-left: 200px;
        float: left;
    }
    body{
        background-image: url("images/background/page_bg.JPG");
        background-size: 100%;

    }

    #top-nav{
        margin-left: 200px;
    }
    a{
        cursor: pointer;
    }
    .title{
        height: 60px;
        text-align: center;
        line-height: 60px;

    }
    .layui-footer{
        color:rgb(102, 102, 102);

    }
    .layui-footer p {
        margin-top:6px;

    }
    .bottom_left{
        margin-left:40%;
        float: left;
        text-align: center;
        font-size: 13px;
    }


    .ul1 li{
        margin-top:6px;
        margin-left: 10px;
        float: left;

    }
    .ul1 li a{
        color:rgb(102, 102, 102);
        font-size: 13px;
    }




</style>

<body>
<ul class="layui-nav layui-bg-cyan" id="top-nav">
    <li class="layui-nav-item">
        <!--<a th:href="@{/tologin}">首页</a>-->
    </li>
    <li class="layui-nav-item">
        <!--<dd raising="main_left"><a data-src="/userinfo">个人中心<span raising="layui-badge-dot"></span></a></dd>-->
    </li>
    <li class="layui-nav-item">
        <a href="#"><img src="/images/2019-08-07/f8aa0870-e4ea-4170-9772-296204476267.jpg" class="layui-nav-img" th:text="'你好，'+${session.user.userName}"></a>

    </li>
    <li class="layui-nav-item">
        <a th:href="@{/tologin}">退出登录</a>

    </li>
</ul>


<div class="left" th:fragment="leftbar">
    <ul class="layui-nav layui-nav-tree  layui-nav-side" lay-filter="test" id="left">
        <li class="title"><a href="#" style="font-size:18px;font-family: 'Century Gothic';color: #bce8f1">宠物寄养管理系统</a></li>
        <li class="layui-nav-item layui-nav-itemed">
            <a href="javascript:;" class="pet">宠物寄养</a>
            <dl class="layui-nav-child" >
                <shiro:hasPermissions name="student_list">
                    <dd class="main_left"><a class="pet" data-src="/addpetinfo"  target="_top" >上传宠物信息</a></dd>
                </shiro:hasPermissions>


                    <dd class="main_left"><a class="pet" data-src="/saisinglist" target="_top">饲养师</a></dd>



                <dd class="main_left"><a class="pet" data-src="/meorder" target="_top">我的订单</a></dd>
                <dd class="main_left"><a class="pet" data-src="/ipet" target="_top">我的宠物</a></dd>

            </dl>
        </li>
        <li class="layui-nav-item">
            <a href="javascript:;" class="order">我的订单</a>
            <dl class="layui-nav-child">

                <dd class="main_left"> <a class="order" data-src="/orderlist" target="_top">查看订单</a></dd>

            </dl>
        </li>
        <li class="layui-nav-item">
            <a href="javascript:;" class="info">信息管理</a>
            <dl class="layui-nav-child">
                <!--<shiro:hasPermission name="addstudent">-->
                <dd class="main_left"><a class="info" data-src="/userinfolist" target="_top">用户信息</a></dd>
                <!--</shiro:hasPermission>-->

                <dd class="main_left"><a class="info" data-src="/raisinginfolist" target="_top">饲养师信息</a></dd>
                <dd class="main_left"><a class="info" data-src="/petinfolist" target="_top">宠物信息</a></dd>
            </dl>
        </li>
        <!--<li raising="layui-nav-item">-->
            <!--<a href="javascript:;">权限管理</a>-->
            <!--<dl raising="layui-nav-child">-->

                <!--<shiro:hasPermission name="allrole">-->
                    <!--<dd raising="main_left"><a data-src="/toallrole" target="_top">所有角色一览</a></dd>-->
                <!--</shiro:hasPermission>-->

                <!--<shiro:hasPermission name="allpermission">-->
                    <!--<dd raising="main_left"><a data-src="/toallpermission" target="_top">角色权限一览</a></dd>-->
                <!--</shiro:hasPermission>-->

                <!--<shiro:hasPermission name="addrole">-->
                    <!--<dd raising="main_left"><a data-src="/torole" target="_top">新增权限角色</a></dd>-->
                <!--</shiro:hasPermission>-->

                <!--<shiro:hasPermission name="authorize">-->
                    <!--<dd raising="main_left"><a data-src="/toaddpermission" target="_top">授予用户权限</a></dd>-->
                <!--</shiro:hasPermission>-->

            <!--</dl>-->
        <!--</li>-->

        <!--<li raising="layui-nav-item"><a href="">大数据</a></li>-->
    </ul>

</div>

<div class="main_right">
    <iframe frameborder="0" scrolling="yes" style="width: 100%" src="" id="aa">



    </iframe>
</div>





<script>
    //注意：导航 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;

        //…
    });
    $(function(){
        $(".main_left a").on("click",function(){
            var address =$(this).attr("data-src");
            $("iframe").attr("src",address);
        });

        var frame = $("#aa");
//        var top = $("#top-nav");
//        var topheight = top.height();
//        console.log("top高度："+topheight);
        var frameheight = $(window).height();
        console.log(frameheight);
        frame.css("height",frameheight);
    });


    $(function(){
        $.ajax({
            url:"/selrole",
            success:function(data){
                if(data == 2){
                    $(".info").hide()
                    $(".pet").hide()
                }else if(data == 3){
                    $(".info").hide()
                    $(".order").hide()
                }else{
                    $(".pet").hide()
                }
            }
        })
    });
</script>
</body>
</html>